import * as request from '../constant/fetchRequest'
import HTTP from '../constant/httpCode'

export const getUser = data => ({
  type: 'GET_SETTINGS',
  data
})

export const initSettings = () => {
  return dispatch => {
    (async () => {
      const res = await request.get('./api/settings')
      if (res.status === HTTP.OK) {
        dispatch(getUser(res.body))
      }
    })()
  }
}
